package org.nf.order.util;

import org.nf.order.vo.PageVO;

import java.util.List;

public class PageUtils  {
    public static int toNumberOf(int page, int limit) {
        return page <= 1 ? 0 : (page - 1) * limit;
    }

    public static <T> PageVO<List<T>> toPageVO(List<T> list, long count) {
        //PageVO<List<T>> pageVO = new PageVO<T>();
        PageVO<List<T>> pageVO = new PageVO<>();
        pageVO.setCount(count);
        pageVO.setData(list);
        pageVO.setCode(0);
        return pageVO;
    }
}
